<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>demo</title>
</head>

<body>
</body>
<script type="text/javascript">
    // repeat方法返回一个新字符串，表示将原字符串重复n次。
    'x'.repeat(3) // "xxx"
    'hello'.repeat(2) // "hellohello"
    'na'.repeat(0) // ""
    'na'.repeat(2.9) // "nana"
    'na'.repeat(Infinity)
    // RangeError
    'na'.repeat(-1)
    // RangeError
    'na'.repeat(-0.9) // ""
    'na'.repeat('na') // ""
    'na'.repeat('3') // "nanana"
</script>

</html>